from templates.config import conn
cur = conn.cursor()
def is_null(username,password): #用户或密码是否为空判断
	if(username=='' or password==''):
		return True
	else:
		return False
def is_existed(username,password): #判断用户名密码是否正确
	sql="SELECT * FROM user WHERE username ='%s' and password ='%s'" %(username,password)
	cur.execute(sql)
	result = cur.fetchall()
	if (len(result) == 0):
		return False
	else:
		return True
def exist_user(username): #判读用户是否存在
	sql = "SELECT * FROM user WHERE username ='%s'" % (username)
	cur.execute(sql)
	result = cur.fetchall()
	if (len(result) == 0):
		return False
	else:
		return True
